<script setup>
const props = defineProps({
    rankList: Array
})
</script>

<template>

    <section class="boxCon">
        <div>
            <img class="title" src="~/assets/resources/index/revenueUserRanking.png" alt="">
        </div>

        <div class="body">
            <div class="articleItem firstLine">
                <div class="itemLeft">
                    <div class="rankBox">
                        排行
                    </div>
                    <div>
                        用户
                    </div>

                </div>

                <p>得分</p>
            </div>
            <div v-for="(item, index) in rankList" class="articleItem">
                <div class="itemLeft">
                    <div class="rankBox">
                        <img class="rankNum" v-if="index == 0" src="~/assets/resources/index/rank1.png" alt="">
                        <img class="rankNum" v-else-if="index == 1" src="~/assets/resources/index/rank2.png" alt="">
                        <img class="rankNum" v-else-if="index == 2" src="~/assets/resources/index/rank3.png" alt="">
                        <div class="rankNum" v-else>
                            {{ index + 1 }}
                        </div>
                    </div>

                    <div>
                        <h2 class="articletitle">
                            {{item.nickName}}
                        </h2>
                        <p class="articleDesc">
                            资源量{{item.assetsNum}} 下载次数{{ item.downNum }}
                        </p>
                    </div>

                </div>

                <div class="infoBox">
                    <p class="info">{{item.allEarnAmount}}</p>
                </div>
            </div>
        </div>

    </section>

</template>

<style scoped lang="scss">
h1,h2,p{
    margin: 0;
}
// 多行隐藏
@mixin textoverflow($clamp: 1) {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    -o-text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: $clamp;
    /*! autoprefixer: ignore next */
    -webkit-box-orient: vertical;
}

.boxCon {
    background: linear-gradient(180deg, #E2E9FB 0%, #F4F7FC 100%);
    border-radius: 10px;
    border: 1px solid #FFFFFF;
    position: relative;
    padding: 15px 10px;
    box-sizing: border-box
}

.title {
    width: 124px;
    display: block;
    margin-bottom: 15px;
}

.body {
    background-color: #ffffff;
    border-radius: 10px;
    padding: 10px 20px;

    .articleItem {
        display: flex;
        padding: 10px 0;
        justify-content: space-between;
        align-items: center;

        .itemLeft {
            display: flex;
            flex: none;
            align-items: center;
        }

        .rankBox{
            width: 28px;
            text-align: center;
            margin-right: 20px;
        }
        .rankNum {
            width: 20px;
            height: 25px;
            text-align: center;
       
        }

        .articletitle {
            font-weight: normal;
            font-size: 16px;
            color: #333333;
            margin-right: 10px;
        }

        .articleDesc {
            font-size: 12px;
            color: #999999;
        }

        // .infoBox{
        //     width: 28px;
        //     text-align: center;
        // }
        .info {
            flex: auto;
            font-size: 14px;
            color: #999999;
            @include textoverflow;
        }
    }

    .firstLine {
        font-size: 14px;
        color: #333333;
    }
}

.footer {
    margin-top: 12px;
}

.btn {
    cursor: pointer;
    width: 100%;
    border: 1px solid #4384FF;
    border-radius: 3px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 3px 0;
    color: #4384FF;
    font-size: 18px;

    .text {
        margin-left: 5px;
    }
}
</style>